package com.taxshare.seller.controller;

import com.taxshare.seller.view.vo.CarManmulInvoiceReqVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.taxshare.response.beans.Response;
import com.taxshare.seller.service.ManualOpenInvoiceService;
import com.taxshare.seller.view.dto.GoodsManageDTO;
import com.taxshare.seller.view.vo.ManmulInvoiceReqVO;


/**
 * @author YANG
 * @date 2021/3/25
 */

@RestController
@RequestMapping("/manualMpenInvoice")
@Api(tags = "手工开票")
public class ManualOpenInvoiceController {
	@Autowired
	ManualOpenInvoiceService manualOpenInvoiceService;

	@PostMapping("/getSubData")
	@ApiOperation(value = "查询商品信息", notes = "手工开票")
	public Response getSubData(@RequestBody GoodsManageDTO goodsManageDTO) {
		return manualOpenInvoiceService.getSubData(goodsManageDTO);
	}

	@PostMapping("/getInvoiceHead")
	@ApiOperation(value = "智能抬头", notes = "手工开票")
	public Response getInvoiceHead(@RequestParam String gfmc,String sellerTaxNo) {
		return manualOpenInvoiceService.getInvoiceHead(gfmc,sellerTaxNo);
	}

	@GetMapping("/getSubByCode")
	@ApiOperation(value = "获取销方信息", notes = "手工开票")
	public Response getSubByCode(@RequestParam String code) {
		return manualOpenInvoiceService.getSubByCode(code);
	}

	@PostMapping("/manualOpenInvoice")
	@ApiOperation(value = "开票", notes = "手工开票")
	public Response manualOpenInvoice(@RequestBody @Valid ManmulInvoiceReqVO manmulInvoiceReqVO) {
		return manualOpenInvoiceService.manualOpenInvoice(manmulInvoiceReqVO);
	}

	@PostMapping("/carManualOpenInvoice")
	@ApiOperation(value = "机动车开票", notes = "手工开票")
	public Response carManualOpenInvoice(@RequestBody @Valid CarManmulInvoiceReqVO vo) {
		return manualOpenInvoiceService.carManualOpenInvoice(vo);
	}

}

